home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1997 March / macformat-048.iso / Shareware Plus / Applications / Fast Eddie ß1 / Tech Info / Mixed Mode Manager next >
Encoding:
Text File  |  1996-12-20  |  2.7 KB  |  108 lines  |  [TEXT/ttxt]

  1.  
  2. FAST EDDIE - MIXED MODE REFERENCE
  3.  
  4.  
  5. Fast Eddie Version: 1.0b
  6.  
  7.  
  8.  
  9. update information
  10.  
  11.  
  12. using the mixed mode
  13.  
  14. structures
  15.  
  16. The PPC subroutine must have the form:
  17.  
  18. void PPCsub ( prozState * );
  19.  
  20. where prozState is following struct:
  21.  
  22. typedef struct {
  23.        unsigned short PC,S,C,X,Y,D;
  24.        unsigned short B;
  25.        unsigned char DBR,PBR;
  26.        unsigned long n,v,b,d,i,z,c,m,x,e;
  27.        void (*PutByte)(unsigned char bank, unsigned short addr, unsigned char x, Boolean mode);
  28.        unsigned char (*GetByte)(unsigned char bank, unsigned short addr, Boolean mode);
  29. } prozState;
  30.  
  31. *GetByte and *PutByte are functions to read and write to the GS memory. The mode flag specifies whether these calls respect special memory areas (true) or not (false). Special memory areas are LC card, bank switched memory, shadowed memory, softswitches, video memory, CX00 IO memory, etc.
  32.  
  33. Note that there's no P register. Modify the status flags directly instead (0 = false, else true). Also, the C register holds just the A register (high byte 0) when m or e = 1. The high byte is then saved in the high byte of B. B is not valid when m = 0.
  34.  
  35. writing stubs
  36.  
  37. Stubs are small subroutines that build the interface between 65816 and PPC code. The actual call is done by the COP command as following example clarifies:
  38.  
  39.   COP   $F0        ; $F0 identifies PPC program in GS memory
  40.   DB    $00           ; zero, forces BRK when running on real 65816
  41.   DB    $01        ; any byte non zero, identifier to prevent accidents
  42.   DB    $A4        ; above byte xor'ed with $A5, another security issue
  43.   DL    PPCCodeAdr ; pointer (65816 little endian) to PPC program in GS memory
  44.  
  45. and
  46.  
  47.   COP   $F1        ; $F1 identifies PPC program in Mac memory
  48.   DB    $00
  49.   DB    $01
  50.   DB    $A4
  51.   DL    PPCCodeAdr ; pointer (65816 little endian) to PPC program in Mac memory
  52.  
  53. Example stub:
  54.  
  55. mult    clc
  56.         xce
  57.         rep  #30
  58.         ldx  A
  59.         ldy  B
  60.         cop  #F0
  61.         db   00,01,A4
  62.         dl   mult_PPC
  63.         sta  C
  64.         sec
  65.         xce
  66.         rts
  67.  
  68. A       ds  2
  69. B       ds  2
  70. C       ds  2
  71.  
  72. writing PPC programs
  73.  
  74. Write the code with any PPC assembler and include it directly into your 65816 assembler.
  75. Note that the code has to be 4-byte aligned!
  76.  
  77. Example PPC program:
  78.  
  79. void mult_PPC ( prozState *p ) { p->C = p->X * p->Y; }
  80.  
  81.  A0830006  lhz      r4,6(r3)
  82.  A0A30008  lhz      r5,8(r3)
  83.  7C8429D6  mullw    r4,r4,r5
  84.  B0830004  sth      r4,4(r3)
  85.  4E800020  blr
  86.  
  87. mult_PPC hex A0830006A0A300087C8429D6B08300044E800020
  88.  
  89.  
  90. general notes
  91.  
  92.   
  93.  
  94. sending bug reports
  95.  
  96. If you find a bug, please send us a short report and the source of the testing program. Our e-mail address is:
  97.  
  98. andre.horstmann@unifr.ch
  99.  
  100.  
  101. downloading latest version
  102.  
  103. -
  104.  
  105.  
  106.  
  107. © 1996, FAST EDDIE LABORATORIES, SWITZERLAND